package cn.smbms.dao.user;

import org.apache.ibatis.annotations.Param;
import cn.smbms.pojo.User;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface UserMapper {
	/**
	 * 通过userCode获取User
	 *
	 * @param userCode
	 * @return
	 * @throws Exception
	 */
	public User getLoginUser(@Param("userCode") String userCode) throws Exception;

	public int add(User user) throws Exception;

	/**
	 * 通过条件查询-userList
	 *
	 * @param
	 * @param userName
	 * @param userRole
	 * @return
	 * @throws Exception
	 */
	public List<User> getUserList(@Param("userName") String userName, @Param("userRole") Integer userRole, @Param("currentPageNo") Integer currentPageNo, @Param("pageSize") Integer pageSize) throws Exception;

	/**
	 * 通过条件查询-用户表记录数
	 *
	 * @param
	 * @param userName
	 * @param userRole
	 * @return
	 * @throws Exception
	 */
	public int getUserCount(@Param("userName") String userName, @Param("userRole") Integer userRole) throws Exception;

	/**
	 * 通过userId删除user
	 *
	 * @param delId
	 * @return
	 * @throws Exception
	 */
	public int deleteUserById(@Param("delId") Integer delId) throws Exception;


	/**
	 * 通过userId获取user
	 *
	 * @param
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public User getUserById(@Param("id") String id) throws Exception;

	/**
	 * 修改用户信息
	 *
	 * @param
	 * @param user
	 * @return
	 * @throws Exception
	 */
	public int modify(User user) throws Exception;


	/**
	 * 修改当前用户密码
	 *
	 * @param
	 * @param id
	 * @param pwd
	 * @return
	 * @throws Exception
	 */
	public int updatePwd(@Param("id") Integer id, @Param("pwd") String pwd) throws Exception;
}
